from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker

# 数据库配置
hostname = '8.134.49.191'
username = 'jiceng_xt'
password = 'dLnjt3X2EsphtbRe'
database = 'jiceng_xt'

# 构造数据库连接URL
DATABASE_URL = f"mysql+pymysql://{username}:{password}@{hostname}/{database}"

# 创建引擎
engine = create_engine(DATABASE_URL, echo=False)

# 创建SessionLocal类
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)

# 声明基类
Base = declarative_base()